🖥️
← Back to KLO Software

BBC Micro Utilities

Command-line tools for viewing BBC Micro files and disk images

Windows Command Line MSI Installer BBC Micro Free

I recently got round to repairing and re-capping the power supply in my BBC Micro Model B, which I bought 40 years ago. Of course I started grabbing various programs and data from it, transferring to my Windows PC as .dsd files, then using those with BeebEm, and I bought a copy of BBC BASIC for Windows so that I could play with that too. I wanted some command-line utilities to display the content of .dsd files, and decode BBC BASIC files along with "PRINT#"-type BBC data files, so I wrote them as console applications using the .NET framework. The utilities are:

All three tools can produce colour output — strings, keywords, and so forth are coloured differently — and can output plain text (in colour when writing to a command prompt window), bbcode, or HTML, optionally launching the browser for the latter. They take wildcards as input and can traverse down through folders.


Example: BBCBasicToText

Here's an example of HTML output using the Sketch program from bbcbasic.co.uk as input, saved on the PC in BBC BASIC tokenized binary as Sketch.bbc:

C:\...\WelcomeDiskFiles> bbcbasictotext Sketch.bbc Sketch.html
BBCBasicToText found 1 file matching Sketch.bbc
Escape non-printable characters: True

BBCBasicToText: processing 1/1, C:\Users\...\BBCMicro\Sketch.bbc

BBCBasicToText Success: 1/1, C:\Users\...\BBCMicro\Sketch.bbc, dialect WindowsOrSDLWithoutLineNumbers

Output: C:\Users\...\BBCMicro\Sketch.html

BBCBasicToText found and processed 1 file, ignored 0, excluded 0, produced results for 1
 X%=10
 Y%=10
 REM Print X in starting place
 PRINT TAB(X%,Y%);"X"
 REPEAT
   Key%=GET
   REM Move cursor in direction after checking
   REM we're still in limits
   CASE Key% OF
     WHEN 139: IF Y% > 0 THEN Y%-=1
     WHEN 137: IF X% < 19 THEN X%+=1
     WHEN 138: IF Y% < 19 THEN Y%+=1
     WHEN 136: IF X% > 0 THEN X%-=1
   ENDCASE
   REM Print X in new position
   PRINT TAB(X%,Y%);"X"
 UNTIL FALSE
 END

It tries to detect the indentation style automatically based on whether the file is an Acorn format BASIC file or BBC BASIC for Windows/SDL, but you can override this with the /w or --windows-style-indent switches. Indentation is applied to FOR, REPEAT, WHILE, and CASE, and it respects EXIT REPEAT etc. You can turn indentation off entirely with --noindent.

I extracted the program from the Welcome disk using:

C:\...\WelcomeDiskFiles> bbcreaddiskimage Welcome.ssd --export=*welcome*

then converted it to bbcode using:

C:\...\WelcomeDiskFiles> bbcbasictotext 0_W.WELCOME *.bbcode /w
BBCBasicToText found 1 file matching 0_W.WELCOME
Escape non-printable characters: True

BBCBasicToText: processing 1/1, C:\...\WelcomeDiskFiles\0_W.WELCOME
BBCBasicToText Success: 1/1, C:\...\WelcomeDiskFiles\0_W.WELCOME
Output: C:\...\WelcomeDiskFiles\0_W.WELCOME.bbcode

Which produced:

  10 REM New version of 'INTRO' from
  20 REM Welcome pack
  30 REM By John Coll & Andrew Gordon
  40 ON ERROR GOTO 630
  50 ENVELOPE 1,1,-RND(50),-RND(50),-RND(45),255,255,255,127,0,0,-127,127,0
  60 SOUND 1,1,255,255
  70 DIM COM%11
  80 M0=650:M1=500:M2=708:M3=104:M4=288:M5=550:M6=720:M7=450:M8=5
  90 MODE5
 100 VDU5
 110 VDU23,255,255,255,255,255,255,255,255,255
 120 GCOL0,135
 130 CLG
 140 VDU18,0,129,24,128;128;1152;896;16,18,0,135,24,256;256;1024;768;16,26
 150 FORI%=M1 TO M2 STEP M3:PROCSWOOSH(M0):PROCLETTER:NEXT
 160 $COM%="DISC SYSTEM"
[Snip rest of "Welcome" BASIC program]

DOSKEY shortcuts

Because typing the full command names is tedious, you can create DOSKEY macros in a command file named cmdsetup.cmd:

doskey brd="<path to exe>\BBCReadDiskImage.exe" $*
doskey btt="<path to exe>\BBCBasicToText.exe" $*
doskey bdt="<path to exe>\BBCDataFileToText.exe" $*

To run this automatically in every new command window, add the following to the registry:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"CompletionChar"=dword:00000009
"DefaultColor"=dword:00000000
"EnableExtensions"=dword:00000001
"PathCompletionChar"=dword:00000009
"AutoRun"="\"%OneDrive%\\<wherever>\\cmdsetup.cmd\""

Features

BBCBasicToText

Display a tokenized, binary BBC Micro BASIC file as text, HTML, or bbcode.

BBCDataFileToText

Show BBC PRINT# type data files as text, HTML, or bbcode.

BBCReadDiskImage

isplay *DIR-style output of .DSD or .SSD disk images, with the ability to export files individually and dump sectors.

DOSKEY shortcuts

Can be automatically added to the set of command window commands


Download

BBC Micro Utilities

Distributed as a Windows MSI installer inside a .zip file. Download from the GitHub releases page:
BBC Micro Utilities v1.0.60.zip

Requires Windows 10 or later and .NET 8 or later.

As always you should be cautious and do due diligence before downloading and running an installer. Please let me know what you think — you can find my contact details via my PGP key on the KLO Software page.


BBC Micro Utilities is free software.
← Back to KLO Software